using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace CMS.Data.Common
{
    public class Files
    {
        public string docLibPath = System.Configuration.ConfigurationSettings.AppSettings["uploadPath"];

        #region Create Instance
        private static Files instance = null;
        public static Files Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new Files();
                }
                return instance;
            }
        }
        #endregion

        public void UploadDocument(string fileName, byte[] data)
        {
            string filePath = Path.Combine(docLibPath, fileName);
            FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
            fs.Write(data, 0, data.Length);
            fs.Close();
        }
    }
}
